function [minim, minil] = get_submatrix(m, l, g)

% ----------------------------------------------
% This function is designed to extract a 
% submatrix from a large adjacency matrix given
% a list of gene to be in the submatrix.
% 
% USAGE:
% [submatrix, submatrix_list] = get_submatrix
%    (matrix, list for matrix, genes_to_extract)
% ----------------------------------------------

shift = 0;
i = 0;
minil = {};

while 1
    i = i + 1;
    [t loc] = ismember(l{i},g);
    if ~t
        m(i - shift, :) = [];
        m(:, i - shift) = [];
        shift = shift + 1;
    else 
        minil{end+1} = l{i};
    end
    
    if i >= length(m), break, end;
end

minim = m;

% DONE